package com.sy.servlet;

import com.sy.service.BrandService;
import com.sy.service.impl.BrandServiceImpl;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.UnsupportedEncodingException;

@WebServlet("/brands/*")
public class BrandServlet extends AbstractBaseServlet {
    private BrandService brandService = new BrandServiceImpl();

    @Override
    public Object doService(String action, HttpServletRequest req, HttpServletResponse res) throws UnsupportedEncodingException {
        //如果是查询所有品牌
        if ("all".equals(action)) {
            return brandService.getAllBrands();
        }
        return null;
    }
}
